package ${basePackage}.controller.${mouduleName};

import ${basePackage}.model.${mouduleName}.${className};
import ${basePackage}.service.${mouduleName}.${className}Service;
import com.cnhis.drgs.core.vo.Response;
import com.cnhis.drgs.core.vo.Page;
<#if '${tableComment}'!=''>import com.cnhis.drgs.core.annotation.Description;</#if>
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/${variableName}")
public class ${className}Controller {

    @Resource
    ${className}Service ${variableName}Service;

    <#if '${tableComment}'!=''>@Description("查询${tableComment}分页列表")</#if>
    @GetMapping("/queryPage")
    public Response queryPage(Page page) {
    return Response.createSuccess(${variableName}Service.queryPage(page));
    }


    <#if '${tableComment}'!=''>@Description("查询${tableComment}列表")</#if>
    @GetMapping("/queryList")
    public Response queryList() {
        return Response.createSuccess(${variableName}Service.queryList(null));
    }


    <#if '${tableComment}'!=''>@Description("查询${tableComment}详情")</#if>
    @GetMapping("/query")
    public Response query(Long id) {
        return Response.createSuccess(${variableName}Service.query(id));
    }


    <#if '${tableComment}'!=''>@Description("保存${tableComment}")</#if>
    @PostMapping("/save")
    public Response save(${className} ${variableName}) {
        ${variableName}Service.saveOrUpdate(${variableName});
        return Response.createSuccess();
    }


    <#if '${tableComment}'!=''>@Description("删除${tableComment}")</#if>
    @PostMapping("/delete")
    public Response del(Long id) {
        ${variableName}Service.delete(id);
        return Response.createSuccess();
    }
}
